import React, { Component } from "react";
import {HashRouter,Switch,Route,Redirect} from 'react-router-dom';
import Login from "../views/login/login";
import NewSandBox from "../views/sandbox/sandbox";

class IndexRouter extends Component{
    render(){
        return (
         <>
         <HashRouter>
            <Switch>
            <Route path='/login' component={Login}></Route>
            <Route path='/' render={()=>
            localStorage.getItem('token')?<NewSandBox></NewSandBox>:<Redirect to='/login'/>}
            ></Route>
            </Switch>
        </HashRouter>
        </>
        )
    }
}
export default IndexRouter;